package com.teewe.model.data
{
	import com.teewe.utils.*;
	
	dynamic public class List extends Array implements IDisposable
	{
		public function List(xml:XML)
		{
			parse(xml);
		}
		
		public function fromArray (array:Array):void
		{
			splice(0, length, array);
		}
		
		protected function parse (xml:XML):void
		{
			if (xml == null)
				return;
				
			var children:XMLList = xml.children();
			var child:XML;
			
			for each (child in children)
				push(ClassUtils.xmlToType(child));
		}
		
		public function dispose ():void
		{
			super.length = 0;
		}
		
		public function toString ():String
		{
			return "com.teewe.model.data.List\n" + join (",")
 		}
	}
}